<template>
  <a-modal :width="1200"
           :title="title"
           :visible="listModalVisible"
           @ok="handleCancel"
           @cancel="listModalVisible=false"
           cancelText="关闭"
  >
    <a-card :bordered="false">


<!--      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->

      <!-- table区域-begin -->
      <div>
        <div class="" style="width: 1100px; height: 100px;display: flex" >
          <a-form-item label="姓名" :labelCol="labelCol" :wrapperCol="wrapperCol">
            <a-input v-model="doctorInfo.name" disabled></a-input>
          </a-form-item>
          <a-form-item label="手机号" :labelCol="labelCol" :wrapperCol="wrapperCol">
            <a-input  v-model="doctorInfo.mobile" disabled></a-input>
          </a-form-item>
          <a-form-item label="所属医院" :labelCol="labelCol" :wrapperCol="wrapperCol">
            <a-input  v-model="doctorInfo.hospital" disabled></a-input>
          </a-form-item>
          <a-form-item label="科室" :labelCol="labelCol" :wrapperCol="wrapperCol">
            <a-input v-model="doctorInfo.department" disabled></a-input>
          </a-form-item>
          <a-form-item label="擅长" :labelCol="labelCol" :wrapperCol="wrapperCol">
            <a-input  v-model="doctorInfo.mobile" disabled></a-input>
          </a-form-item>
        </div>


        <a-table
          ref="table"
          size="middle"
          :scroll="{x:true}"
          bordered
          rowKey="id"
          :columns="columns"
          :dataSource="assistantInfo"
          :pagination="ipagination"
          :loading="loading"
          :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
          class="j-table-force-nowrap"
          @change="handleTableChange">

          <template slot="htmlSlot" slot-scope="text">
            <div v-html="text"></div>
          </template>
          <template slot="imgSlot" slot-scope="text">
            <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
            <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
          </template>
          <template slot="fileSlot" slot-scope="text">
            <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
            <a-button
              v-else
              :ghost="true"
              type="primary"
              icon="download"
              size="small"
              @click="downloadFile(text)">
              下载
            </a-button>
          </template>
        </a-table>
      </div>
      <wx-user-list-modal ref="wxUserListModal"></wx-user-list-modal>
      <wx-userinfo-modal ref="modalForm" @ok="modalFormOk"></wx-userinfo-modal>
    </a-card>
  </a-modal>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { mixinDevice } from '@/utils/mixin'
import DoctorModal from '../DoctorModal'
import DoctorTestModal from './DoctorTestModal'
import Area from '@comp/_util/Area'
import { getAction } from '@api/manage'

export default {
name: "DoctorListModal",


  inject: ['reload'],
  mixins:[JeecgListMixin, mixinDevice],
  components: {
    DoctorModal,
    DoctorTestModal,

  },

  data () {
    return {
      description: 'wx_userinfo管理页面',
      title:"医生信息",
      listModalVisible:false,
      wx_userinfo_id: " ",
      id:" ",
      labelCol: {
        xs: { span: 8 },
        sm: { span: 8 },

      },
      wrapperCol: {
        xs: { span: 20 },
        sm: { span: 16 },
      },
      columns: [
        {
          title:'助理id',
          align:"center",
          dataIndex: 'id'
        },
        {
          title:'姓名',
          align:"center",
          dataIndex: 'name'
        },
        {
          title:'手机号',
          align:"center",
          dataIndex: 'mobile'
        },
      ],
      url: {
        list: "/doctor/doctor/queryAssistantInfo",
      },
      doctorInfo:{},    //医生数据
      assistantInfo:{}, //助理数据

    }
  },
  created() {
    this.pcaData = new Area()
    this.showDoctor();
  },
  computed: {
    importExcelUrl: function(){
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    },
  },
  methods: {
    initDictConfig(){
    },
    showDoctor(record){
      let param = {};
      param.id = record.id;
      getAction(this.url.list, param).then(res => {
        this.doctorInfo = res.result[0];
        this.assistantInfo = res.result[1];
      })
      this.listModalVisible = true;
    },

    handleCancel(){
      this.listModalVisible = false;
    },
  }
}
</script>

<style scoped>
@import '~@assets/less/common.less';
</style>